<!DOCTYPE html>
<html lang="en">
<head th:include="certificateWeb/headFoot :: headerCss">
</head>
<link rel="stylesheet" href="/css/certificateWeb/workNews/workNews.css">
<style>
    .b18 {
        width: 300px;
        margin: 0 auto 20px auto;
    }

    .download {
        border: 1px solid red;
        color: red;
        padding: 4px;
        margin-right: 20%;
        text-decoration: underline;
    }

</style>
<body id="body">
<div th:include="certificateWeb/headFoot :: header"></div>
<main id="main">
    <section class="sec_1">
        <div class="div_1">
            <ul>
                <li><a href="/certificate/testingCentreQuery">考核站点查询</a></li>
                <li><a href="/certificate/testingCentreQueryPx">培训基地查询</a></li>
                <li><a href="/certificate/certificateQuery">1+x证书查询</a></li>
                <li class="this"><a href="/certificate/personalCertificateQuery">个人证书</a></li>
                <li><a href="/certificate/schoolCertificateQuery">学校证书</a></li>
                <li><a href="/certificate/expertQuery">专家查询</a></li>
            </ul>
        </div>

        <div class="div_2">
            <label class="label_title">个人证书</label>
            <hr/>

            <div class="flex_a" style="margin: 20px auto auto 82px">
                <input type="text" name="idNumber" 　id="idNumber" placeholder="请输入身份证号" class="form-control"
                       style="width: 220px;margin-right: 20px;"/>
                <input type="text" name="number" 　id="number" placeholder="请输入证书编号 " class="form-control"
                       style="width: 220px;margin-right: 20px;"/>
                <input type="text" name="mobile" 　id="mobile" placeholder="请输入手机号 " class="form-control"
                       style="width: 220px;margin-right: 20px;"/>
                <!--                <input type="text" name="mobile" 　id="mobile" placeholder="报名手机号" class="form-control" />-->
                <!--                <input type="text" name="mobile" 　id="mobile" placeholder="报名手机号" class="form-control" />-->
                <input class="form-control but_2" type="button" id="search" value="查询"/>
            </div>
            <div style="margin-left: 90px;margin-top:10px;color: red;font-size: 12px">*提示：至少输入一个查询条件</div>
            <div id="listbox" style="margin-top: 20px">
            </div>
        </div>
        <div style="clear: both"></div>
    </section>

</main>
<div th:include="certificateWeb/headFoot :: footer"></div>
<script>
    $(function () {
        $("#search").click(function () {
            var numberCard = $("#number").val();
            var idNumberCard = $("#idNumber").val();
            var mobileCard = $("#mobile").val();
            if (!numberCard && !idNumberCard && !mobileCard) {
                layer.msg("请输入您需要查询的信息！");
                return;
            }
            //查询简历·
            //  ajaxToken("/jzApi/user/selResume", "GET", {}, function (res) {
            // ajaxToken("/jzApi/user/selResume", "GET", {}, function (res) {

            // if (res.state == 0){
            // var mobile = $("#mobile").val();

            $.ajax({
                url: '/jzweb/trainingCertificates/selTrainingCertificates',
                type: 'GET',
                data: {
                    numbers: $("#number").val(),
                    idNumber: $('#idNumber').val(),
                    mobile: $('#mobile').val()
                },
                success: function (res) {
                    console.log(res)
                    if (res.code == '0') {
                        var gradeName = '';
                        if (res.data.grade == 0) {
                            gradeName = '高级'
                        } else if (res.data.grade == 1) {
                            gradeName = '中级'
                        } else {
                            gradeName = res.data.grade;
                        }
                        var isEffective = '';
                        if (res.data.isEffective == '0' || res.data.isEffective == 0) {
                            isEffective = '有效'
                        } else if (res.data.isEffective == 1) {
                            isEffective = '无效'
                        } else {
                            isEffective = '有效'
                        }
                        var list = res.data.records
                        var content = ''
                        list.forEach(function (item, index) {
                            content += '<image style="width:900px;height:636px;display: block;: 20px auto;text-align: center" src="' + item.imgUrl + '"></image>' +
                                '<div class="span_1" style="text-align: right"><a download target="_blank" href="' + item.imgUrl + '" class="download">下载图片</a></div>' +
                                // '<div class="span_1 b18"><span class="title_1">证书名称：</span><p class="title_2">' + res.data.certificateName + '</p></div>' +
                                //  '<div class="span_1 b18"><span class="title_1">证书等级：</span><p class="title_2">' + gradeName + '</p></div>' +
                                // '<div class="span_1 b18"><span class="title_1">证书名称：</span><p class="title_2">' + res.data.certificateName + '</p></div>' +
                                //  '<div class="span_1 b18"><span class="title_1">证书等级：</span><p class="title_2">' + gradeName + '</p></div>' +
                                '<div class="span_1 b18"><span class="title_1">证书编号：</span><p class="title_2">' + item.numbers + '</p></div>' +
                                // '<div class="span_1 b18"><span class="title_1">获证人姓名：</span><p class="title_2">' + res.data.name + '</p></div>' +
                                '<div class="span_1 b18"><span class="title_1">获证时间：</span><p class="title_2">' + item.getTime + '</p></div>'

                        })
                        $("#listbox").html(content);
                    } else {
                        layer.msg(res.msg)
                    }

                }
            })
            /*      }else {

                      layer.confirm("请先完善简历", {
                          btn: ['前去完善', '暂不完善']
                      }, function (index, layero) {
                          location.href = '/certificate/isResume'
                      }, function (index) {

                      })

                  }*/
            // });
            // })
        })
    })
</script>
</body>
</html>